package com.yc.controller;

import com.yc.bean.FoodBean;
import com.yc.model.ResponseResult;
import com.yc.service.FoodBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zwei
 * @create 2024-10-07 15:33
 */
@RestController
@RequestMapping("/food")
public class FoodController {

    private final FoodBiz foodBiz;
    @Autowired
    public FoodController(FoodBiz foodBiz) {
        this.foodBiz = foodBiz;
    }
    @PostMapping("/getFood")
    public ResponseResult getFood(){
        List<FoodBean>list=foodBiz.getFood();
        return ResponseResult.ok().setData(list);
    }
    @PostMapping("/getfoodbyid/{foodid}")
    public ResponseResult getfoodbyid(@PathVariable Integer foodid){
        List<FoodBean>list=foodBiz.getfoodbyid(foodid);
        return ResponseResult.ok().setData(list);
    }
}
